package com.clz.appdesign.myapp.view.myself;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

public class BaseView extends View {
    public BaseView(Context context) {
        super(context);
    }

    public BaseView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public BaseView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        //设置画笔的基本属性
        Paint paint = new Paint();
        // 设置画笔颜色
        paint.setColor(Color.RED);
        // 设置填充样式
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(50);
        // 画圆
       //canvas.drawCircle(190, 200, 150, paint);

        // 两个不同的圆
        paint.setColor(0XFFFF0000);
        paint.setStyle(Paint.Style.FILL);
        paint.setStrokeWidth(50);
        //canvas.drawCircle(210,210,150,paint);

        paint.setColor(0x7EFFFF00);
       // canvas.drawCircle(210,210,100,paint);


        // canvas的使用
        // 设置画布的颜色
       // canvas.drawColor(Color.YELLOW);
       // canvas.drawRGB(0XFF,0x00,0xFF);
        //canvas.drawARGB(0xEF,0xFF,0,0xFF);

        // 画直线
       // canvas.drawLine(50,200,250,50,paint);
    }
}
